package com.longge;

import java.util.Arrays;

public class DeleteGreatestValue {

    public int deleteGreatestValue(int[][] grid) {

        for (int[] ints : grid) {
            Arrays.sort(ints);
        }

        int ans = 0;
        for (int i = 0; i < grid[0].length; i++) {
            int max = Integer.MIN_VALUE;
            for (int[] ints : grid) {
                int num = ints[i];
                max = Math.max(num, max);
            }
            ans+=max;
        }


        return ans;

    }
}
